import require from './require'

/**
 * 
 * @param {*} model 
 * @returns 获取商品列表
 */
export const getgoodslist=(params)=>require.get('goods',{params})

/**
 * 
 * @param {*} id 
 * @returns 删除接口
 */
export const deletelist=(id)=>require.delete(`goods/${id}`)

/**
 * s
 * @param {*} model 
 * @returns 级联选择器
 */
export const categorieslist=(model)=>require.get('categories',model)

/**
 * 
 * @param {*} model 
 * @returns 商品分类请求
 */
export const getcategories=(model)=>require.get(`categories?type=3`,model)


/**
 * 
 * @param {*} model 
 * @returns 编辑商品分类
 */
export const updatacategories=(model)=>require.put(`categories/:${model.id}`,model)

/**
 * 
 * @param {*} model 
 * @returns 删除商品分类
 */
export const delcategories=(id)=>require.delete(`categories/${id}`)

/**
 * 
 * @param {*} model 
 * @returns 分类参数级联选择器
 */
export const getparams=(id,type)=>require.get(`categories/${id}/attributes?sel=${type}`)

/**
 * 
 * @returns 添加商品
 */
export const addgoods=(model)=>require.post('goods',model)


/**
 * 删除分类参数
 */
export const deleteparams=(id)=>require.delete(`categories/6/attributes/${id}`)


/**
 * 
 * @param {*} model 
 * @returns 修改参数名称
 */
export const updataparams=(model)=>require.put(`categories/${model.cat_id}/attributes/${model.attr_id}`,model)

/**
 * 
 * @param {*} model 
 * @returns 添加参数
 */
export const addparams=(model)=>require.put(`categories/${model.cat_id}/attributes`,model)

/**
 * 
 * @param {*} model 
 * @returns 获取添加分类的级联选择器数据
 */
export const getcascader=(model)=>require.get(`categories`,{params:model})

/**
 * 
 * @param {*} model 
 * @returns 添加分类
 */
export const addcascader=(model)=>require.post(`categories`,model)

/**
 * 
 * @param {*} model 
 * @returns 编辑分类
 */
export const updatacascader=(model)=>require.put(`categories/${model.cat_id}`,model)

/**
 * 
 * @param {*} model 
 * @returns 编辑商品
 */
export const updatagoods=(model)=>require.put(`goods/${model.goods_id}`,model)

/**
 * 添加小标签 categories/74/attributes/3919
 */

 
 export const addsmall=(id,model)=>require.put(`categories/${id}/attributes${model.attr_id}`,model)
 /**
  * 
  * @param {*} model 
  * @returns 删除小标签
  */
 export const deletesmall=(id,model)=>require.delete(`categories/${id}/attributes${model.attr_id}`,model)


 /**
  * 
  * @param {*} model 
  * @returns 添加商品
  */
 export const addgoodslist=(model)=>require.post('goods',model)